from flask import Flask, render_template, jsonify

app = Flask(__name__)


@app.route('/')
@app.route('/<name>')
def index(name=None):
    return render_template('home.html', person=name)


@app.route('/home/')
def home():
    return '<h1>Flask Home Page.</h1>'


@app.route('/about/')
def about():
    # 模版渲染
    return render_template('about.html', name='张三')
    # JSON
    # jsonify: 序列化
    # return jsonify({'name': '张三', 'age': 20})


if __name__ == '__main__':
    app.run(debug=True, port=5000, host='0.0.0.0')
